In order to improve the accuracy and universality of computer-assisted classification algorithm, a Electrocardiography (ECG) beat classification algorithm based on cluster analysis was presented in this paper. The algorithm considered that one patients' ECG beats repeated periodically, and used the method of two-stage cluster analysis, and selecting representative ECG beats, combined with the diagnosis of cardiac physicians to achieve accurate ECG beat classification rate. In order to verify the accuracy of the algorithm, using the internationally standard database MIT-BIH arrhythmia database, the ECG beat classification method and the accuracy evaluation method specified by AAMI/ANSI standard were used to perform simulation experiments, the final overall classification accuracy rate is 99.07%. Compared with Kiranyaz' method(KIRANYAZ S, INCE T,PULKKINEN J, et al. Personalized long-term ECG classification: A systematic approach[J]. Expert Systems with Applications, 2011, 38(4): 3220-3226.), this method does not require specific training step, and the sensitivity of the ECG beats which labeled as S raise to 89.82% from 40.15%, significantly improving classification algorithm's generalization capability.